<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
	</head>
	<body>
		<h1>第143题：将1000000000形式的字符串，以每3位进行分割展示'1,000,000,000'(百度)</h1>
<pre>
	<code>
		var str = '1000000000';
		var len = str.length;
		var strArr = str.split("").reverse();
		for(var i = 0; i < strArr.length; i++){
			if(i%3 === 0 && i!==0){
				strArr.splice(i,1,strArr[i]+',');
			}
		}
		strArr = strArr.reverse().join("");
	</code>
</pre>
				
			
		
		<script type="text/javascript">
			var str = '1000000000';
			var len = str.length;
			var strArr = str.split("").reverse();
			for(var i =0;i<strArr.length;i++){
				if(i%3===0 && i!==0){
					strArr.splice(i,1,strArr[i]+',')
				}
			}
			strArr = strArr.reverse().join("")
			alert(strArr)
		</script>
	</body>
</html>
